package storage

import (
	"context"

	"mall/service/wpgql/api/internal/graph/model"
)

type Storage interface {
	PutCategory(ctx context.Context, category *model.Category) error
	GetCategories(ctx context.Context, ids []string) ([]*model.Category, error)
	GetAllCategories(ctx context.Context) ([]*model.Category, error)
	PutMenuItem(ctx context.Context, menuItem *model.MenuItem) error
	GetMenuItems(ctx context.Context, ids []string) ([]*model.MenuItem, error)
	GetAllMenuItems(ctx context.Context) ([]*model.MenuItem, error)
	PutUser(ctx context.Context, user *model.User) error
	GetUsers(ctx context.Context, ids []string) ([]*model.User, error)
	GetAllUsers(ctx context.Context) ([]*model.User, error)
	RetrieveUserByCredentials(ctx context.Context, userLogin string, password string) (*model.User, error)
}

type MemoryStorage struct {
	categories map[string]*model.Category
	menuItems  map[string]*model.MenuItem
	users      map[string]*model.User
}

func NewMemoryStorage() *MemoryStorage {
	return &MemoryStorage{
		categories: make(map[string]*model.Category),
		menuItems:  make(map[string]*model.MenuItem),
		users:      make(map[string]*model.User),
	}
}
